<%@page import="java.io.DataOutputStream"%>
<%@page import="java.io.FileInputStream"%>
<%@page import="java.io.BufferedInputStream"%>
<%@page import="java.io.InputStream"%>
<%@page import="java.io.File"%>
<%@page import="Configurations.FileOperations"%>
<%
    session.setAttribute("displayPage", "downloadPDF");
    // Redirect if this page is being displayed by itself
    if (request.getServletPath().equals("/downloadPDF.jsp")) {
        System.out.println("Current Page is set to downloadPDF. Redirect to index.jsp");
        response.sendRedirect("");
    }
%>
<h3>Download PDF Files</h3>
<%
    File fileList[] = FileOperations.getFiles();
    for (int i = 0; i < fileList.length; i++) {
        if (!fileList[i].isDirectory()) {
            System.out.println(fileList[i].getPath());
            String temp = fileList[i].getPath();
            if (temp.indexOf(".pdf") != -1) {
                out.println("<a href=\"" + "../" + fileList[i].getName() + "\">" + fileList[i].getName() + "</a><br/>");
            }
        }
    }
%>